/**
 * 
 */
package com.angel.configuration.container;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.angel.architecture.persistence.beans.ConfigurationParameter;
import com.angel.configuration.initializer.ConfigurationInitializer;
import com.angel.configuration.initializer.impl.ActionStrategiesInitializer;
import com.angel.configuration.initializer.impl.ExportRowStrategiesInitializer;
import com.angel.configuration.initializer.impl.ExportStrategiesInitializer;
import com.angel.configuration.initializer.impl.ImportRowStrategiesInitializer;
import com.angel.configuration.initializer.impl.ImportStrategiesInitializer;
import com.angel.configuration.initializer.impl.SearchStrategiesInitializer;
import com.angel.configuration.initializer.impl.UserGeneratorsInitializer;

/**
 * @author William
 *
 */
public class ConfigurationInitializerContainer{

	private List<ConfigurationInitializer> initializers = new ArrayList<ConfigurationInitializer>();

	@SuppressWarnings("unchecked")
	public <T extends ConfigurationInitializer> void initInitializers() {
		initializers.add((T) new ActionStrategiesInitializer());
		
		initializers.add((T) new ExportStrategiesInitializer());
		initializers.add((T) new ExportRowStrategiesInitializer());
		
		initializers.add((T) new ImportStrategiesInitializer());
		initializers.add((T) new ImportRowStrategiesInitializer());
		
		initializers.add((T) new SearchStrategiesInitializer());
		
		initializers.add((T) new UserGeneratorsInitializer());
	}

	public void configure(Collection<ConfigurationParameter> parameters) {
		for(ConfigurationInitializer ci: initializers){
			for(ConfigurationParameter cp: parameters){
				if(ci.appliesConfiguration(cp)){
					ci.addConfiguration(cp);
				}
			}
		}
	}

}
